Fix set_registry_token call for token usa - #1370
Conversation
|
🤖 Finished Review · ✅ Success · Started 6:30 AM UTC · Completed 6:50 AM UTC |
1bc0ed6 to
ea42f2c
Compare
PR Summary by QodoScope overwrite_from_index_token to same-registry images during resolution
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Labels: PR fixes token scoping behavior in registry authentication logic — a bug fix Next steps:
Previous run (2)ReviewReason: stale-head The review agent reviewed commit |
|
/fs-review |
Code Review by Qodo
1.
|
|
🤖 Finished Review · ✅ Success · Started 6:50 AM UTC · Completed 7:07 AM UTC |
lipoja
left a comment
There was a problem hiding this comment.
Once you address the [medium] logic-error you can merge it.
LGTM.
…h-scoped Docker auth Fixes CLOUDDST-32419 and CLOUDDST-32824 by applying the overwrite token only where worker Docker config cannot already pull the image, and by avoiding blanket token stamping that broke unrelated private fragments and namespace template credentials. Co-authored-by: Cursor <cursoragent@cursor.com>
ea42f2c to
f0936e7
Compare
|
🤖 Finished Review · ✅ Success · Started 1:35 PM UTC · Completed 2:16 PM UTC Commit: |
Superseded by updated review
| @@ -1097,7 +1257,7 @@ def get_index_image_info( | |||
| if not from_index: | |||
There was a problem hiding this comment.
[medium] credential-scope-change
Changing get_index_image_info from append=False to append=True changes credential merging behavior, potentially inheriting credentials from a prior set_registry_token context if one is active.
Suggested fix: Verify get_index_image_info is never called within another set_registry_token context. Document why append=True is needed.
| return {} | ||
|
|
||
|
|
||
| def docker_config_has_auth_for_image( |
There was a problem hiding this comment.
This one is never used in IIB code - only in tests, can we remove it if it is not needed?
|
LGTM, lets fix the linting errors and remove the unused code. |
|
Apart from the comments above LGTM. Once we migrate to the Pods, would it make sense, to craft the credentials file (docker config) per command? That way, we would have better control over the credentials. |
|
Hello - wondering how long before this gets merged? I've been waiting for this to be done so I can once again do 'manual' IIB job submissions (I have the relevent credentials) to remove or add bundles in the Certified, Marketplace, or Community bundle indexes. |
yashvardhannanavati
left a comment
There was a problem hiding this comment.
@chandwanitulsi could you please fix the tests too?
| with set_registry_token( | ||
| overwrite_from_index_token, fragments_needing_token, append=True | ||
| ): | ||
| for i, fbc_fragment in enumerate(fbc_fragments): |
There was a problem hiding this comment.
nit: repeated code. Consider creating a helper function.
| Broader credentials already present in the Docker configuration, such as registry- or | ||
| namespace-level entries for the same host, are not modified. Only the scoped ``auths`` key | ||
| derived from ``container_image`` is set or overwritten. | ||
| derived from each image is set or overwritten. When the worker config has no |
There was a problem hiding this comment.
The namespace-level fallback in set_registry_token applies to all callers, not just the resolve/opm paths this PR targets. When the overwrite token is repo-scoped (not namespace-wide), stamping the shared registry/namespace key can cause same-namespace images that were previously pulled anonymously or via a registry-level template cred to fail with 401/403. Is this an acceptable risk?
| return keys | ||
|
|
||
|
|
||
| def _load_docker_config_auths() -> Dict[str, Any]: |
There was a problem hiding this comment.
The capability is needed, but it introduces a third, differently-behaving config reader alongside the append block (reads ~/.docker/config.json, raises on bad JSON) and set_registry_auths (reads the template only):
- It prefers ~/.docker/config.json over the template, but the credentials actually applied come from the template. These agree only when config is the post-reset_docker_config symlink; with a leftover/nested real config, the "already covered" decision is made against a different source than what gets merged. For a "does the worker have baseline creds" check, the template is the source of truth.
- It swallows OSError/JSONDecodeError and returns {}, which makes token stamping broader on a read error (empty auths ⇒ everything looks uncovered) — the opposite of this PR's intent, and inconsistent with the append block that raises on the same error.
Assisted-by: Cursor/Gemini